
package com.roomio.core.dao;

import java.io.Serializable;
import java.util.List;

import org.hibernate.Criteria;

/**
 * Data Access Object (DAO) interface using Java Generics. This is an interface
 * used to tag DAO classes and to provide common methods to all DAOs.
 * 
 * @author <a href="mailto:og.tech79@gmail.com">Shailendra Sinha</a>
 */
public interface GenericDAO<T extends Serializable, ID extends Serializable> {
	public void setClazz(Class clazz);

	public int count();

	public boolean exists(ID id);

	public void delete(T t);

	public void deleteById(ID id);

	public void deleteAll();

	public T load(ID id);

	public T get(ID id);

	public List<T> findAll();
	
	public List<T> findAll (Integer startRow, Integer maxResults);

	public T findById(ID id);

	public List<T> findByCriteria(T t);
	public List<T> findByCriteria (T t, Integer startRow, Integer maxResults);

	public List<T> findByCriteria(Criteria criteria);

	// public Criteria createCriteria(Criterion... criterion);
	public Criteria createCriteria(T t);

	public void save(T t);

	public void update(T t);
	public void update(List<T> tList) ;
	
	public List<T> findByQuery(String queryName, String[] params, Object[] values);
	public List<T> findByQuery(String queryName, String[] params, Object[] values, Integer startRow, Integer maxResults);

	public List<T> findByNamedQuery(String query, String[] params, Object[] values);

	public List<T> findByNamedQuery(String query, String[] params, Object[] values, Integer startRow, Integer maxResults);

}
